/*
 * @Author: jhw
 * @Date: 2025-08-14 23:21:18
 * @LastEditors: jhw
 * @LastEditTime: 2025-08-16 13:26:02
 * @Description:
 */

import { componentMap } from '@/configs/componentMap';
import type { EditComName, Status } from '@/types';

// 还原问卷-根据后端返回数据还原问卷组件
export const restoreSurvey = (coms: Status[]) => {
  coms.forEach((com) => {
    com.type = componentMap[com.name];
    for (const key in com.status) {
      const name = com.status[key].name as EditComName;
      com.status[key].editCom = componentMap[name];
    }
  });
};
